/**
 * Copyright (c) 2012, Camelot and/or its affiliates. All rights reserved.
 * Camelot PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.camelot.ccr.global.web.aop;

import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;

import com.camelot.ccr.global.util.Utility;

/**
 * <pre>
 * 监控预算流程数据丢失
 * </pre>
 * @author Liu Jun
 * @version V0.1, 2014-3-18 下午4:27:06
 */
public class BuggdetLog {

	private static Logger logger = Logger.getLogger(BuggdetLog.class);
	
	/**
	 * <pre>
	 * 前置通知
	 * </pre>
	 * @param jp 连接点
	 * @author Liu Jun, 2014-3-18 下午5:27:00
	 */
	public void doBefore(JoinPoint jp) {  
        System.out.println("前置通知：log Begining method: "  
                + jp.getTarget().getClass().getName() + "."  
                + jp.getSignature().getName());  
        logger.info("前置通知log Begining method: "+jp.getTarget().getClass()+"."+jp.getSignature().getName());
        Object[] objects = jp.getArgs();
		if(Utility.isNotEmpty(objects)){
			logger.info("参数如下：");
			for(Object o : objects){
				if(Utility.isNotNull(o)){
					logger.info(o.toString()+"***");
					System.out.println(o.toString()+"***");
				}
			}
		}
		System.out.println("前置通知结束");
		logger.info("前置通知结束");
    }  
	/**
	 * <pre>
	 * 后置通知
	 * </pre>
	 * @param jp 连接点
	 * @author Liu Jun, 2014-3-18 下午5:27:00
	 */
	public void doAfter(JoinPoint jp) {  
        System.out.println("后置通知：log Begining method: "  
                + jp.getTarget().getClass().getName() + "."  
                + jp.getSignature().getName());  
        logger.info("后置通知log Begining method: "+jp.getTarget().getClass()+"."+jp.getSignature().getName());
        Object[] objects = jp.getArgs();
		if(Utility.isNotEmpty(objects)){
			logger.info("参数如下：");
			for(Object o : objects){
				if(Utility.isNotNull(o)){
					logger.info(o.toString()+"***");
					System.out.println(o.toString()+"***");
				}
			}
		}
		System.out.println("后置通知结束");
		logger.info("后置通知结束");
    }
}
